import React, { Component } from 'react'
import lcss from './css/left.module.css'
import axios from 'axios'

export default class recommend extends Component {
    state = {
data:[]
    }
    componentDidMount() {
        axios('/tyj/tuijian').then((res) => {
            // console.log(res.data);
           
            let data = res.data;
            let newArr = [];
            for (let i = 1; i <= 5; i++) {
                let num = parseInt(Math.random() * data.length);
                newArr = newArr.concat(data.slice(num, num + 1));
            }
            this.setState({
                data: newArr
            })
        })
    }
    render() {

        return (
            <div>
               
                    <div className={lcss.right_bottom}>
                        <h3>推荐关注</h3>
                        <div className={lcss.brand}>
                            {this.state.data.map((el, index) => {
                                return (<div className={lcss.brand_box} key={index}>
                                     <img src={el.logo} alt="" className={lcss.touxiang} />
                                    <div className={lcss.brand_text}>
                                        <div>{el.brandName}</div>
                                        <p>{el.summary}</p>
                                        <button className={lcss.guanzhu}>关注</button>
                                    </div>
                                </div>)
                            })}

                        </div>
                    </div>
                </div>
        )
    }
}
